"""DjangoBase URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include

# 导入django实现的注册路由解析器register_converter
from django.urls.converters import register_converter
# 导入自定义的路由解析器
from converters import MobileConverter
# 注册路由解析器,格式：register_converter(自定义路由解析器，'别名')
register_converter(MobileConverter, 'mobile')

urlpatterns = [
    path('admin/', admin.site.urls),

    # 子应用users在总路由中注册，每一个子应用只需要注册一次
    path('', include("users.urls")),

    # 子应用request_response路由注册
    # path('', include("request_response.urls")),
    # 使用路由的反向解析，需要在总路由给子应用起别名
    # path('', include(('子路由', '子应用名字'), namespace='总路由别名，可以随便命名')),
    path('', include(('request_response.urls', 'request_response'), namespace="request_response")),

    # 子应用booktest路由注册
    path('', include('booktest.urls')),

    path('', include('template_test.urls')),
]
